import request from "@/utils/request";

// 根据业务主键获取单个附件信息
export function getCaseAttaByAttaOid(attaOid) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/case/caseAtta/queryCaseAttaByOid?attaOid=" +
      attaOid,
    method: "get"
  });
}
export function getPdf(fileOid) {
  return request({
    url:
      process.env.VUE_APP_BJFW_ROUTE_PATH +
      "/sysAttaService/download?attaOid=" +
      fileOid,
    method: "get",
    headers: {
      "Content-Type":
        "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
    },
    responseType: "blob" //设置响应的数据类型为一个包含二进制数据的 Blob 对象，必须设置！！！
  });
}

// 根据业务主键获取单个附件信息
export function getMaterialAttaByAttaOid(attaOid) {
  return request({
    url:
      process.env.VUE_APP_SX_ROUTE_PATH + "/sxSys/file/downloadFile/" + attaOid,
    method: "get"
  });
}

export function getMaterialPdf(fileOid) {
  return request({
    url:
      process.env.VUE_APP_SX_ROUTE_PATH + "/sxSys/file/downloadFile/" + fileOid,
    method: "get",
    headers: {
      "Content-Type":
        "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
    },
    responseType: "blob" //设置响应的数据类型为一个包含二进制数据的 Blob 对象，必须设置！！！
  });
}

/**
 * 根据附件attaOid查询附件数据
 */
export function queryKstbAttaByOid(attaOid) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/common/atta/queryKstbAttaByOid/${attaOid}`,
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    }
  });
}
